package edu.nf.bs.service.impl;

import edu.nf.bs.dao.AdminMapper;
import edu.nf.bs.entity.Admin;
import edu.nf.bs.exception.LoginException;
import edu.nf.bs.service.AdminService;

public class AdminServiceImpl implements AdminService {
    private AdminMapper adminMapper;

    public void setAdminMapper(AdminMapper adminMapper) {
        this.adminMapper = adminMapper;
    }

    @Override
    public Admin checkAdminHost(Admin admin) {
        Admin adminHost = adminMapper.getAdminHost(admin.getAdminHost());
        if(adminHost!=null){
            if(adminHost.getAdminPass().equals(admin.getAdminPass())){
                return adminHost;
            }
            throw new LoginException("帐号或密码错误");
        }
        throw new LoginException("帐号或密码错误");

    }
}
